package com.cskaoyan.day31.work1._04_proxy._01_static_proxy;

import com.cskaoyan.day31.work1._04_proxy._00_bean.BuyFood;
import com.cskaoyan.day31.work1._04_proxy._00_bean.Study;
import com.cskaoyan.day31.work1._04_proxy._00_bean.User;

public class UserProxy3Common implements BuyFood, Study {

    User user = new User();
    public void setUser(User user){
        this.user = user;
    }
    @Override
    public void buyBreakfast(String name) {
        this.user.buyBreakfast(name);
        this.invoke();
    }



    @Override
    public void buyLunch(String name) {
        this.user.buyLunch(name);
        invoke();
    }

    @Override
    public void buyDinner(String name) {
        user.buyDinner(name);
        invoke();
    }

    @Override
    public String study(String name1, String name2) {
        String study = user.study(name1, name2);
        invoke();
        return study;
    }


    private void invoke() {
        System.out.println("购买冰红茶");
    }
}
